package view;

import java.util.ArrayList;
import javax.swing.JFrame;
import view.backend.graveyard.AdminGraveYard;
import view.backend.customer.AdminCustomer;
import view.frontend.order.OrderContainer;
import view.frontend.order.OrderCustomer;
import view.frontend.order.OrderGraveYard;
import view.menu.Menu;
import view.menu.MenuLabel;

/**
 * 
 * @author Sonny Sandberg
 */
public class ViewSingleton 
{
    private static ViewSingleton singletonObject;
    private JFrame mainFrame;
    private ArrayList<ViewContainer> allViews;
    private view.menu.Menu[] menus;
    private ArrayList<MenuLabel> menuLabels;
    private AdminGraveYard adminGraveYard;
    private AdminCustomer adminCustomer;
    private OrderGraveYard orderGraveYard;
    private OrderCustomer orderCustomer;
    private ViewSingleton() 
    {
        mainFrame = null;
        allViews = new ArrayList();
        menuLabels = new ArrayList();
        menus = new view.menu.Menu[2];
        
        adminGraveYard = null;
        adminCustomer = null;
        orderGraveYard = null;
        orderCustomer = null;
    }
    
    public static synchronized ViewSingleton getSingletonObject() 
    {
        if (singletonObject == null) 
        {
            singletonObject = new ViewSingleton();
        }
        return singletonObject;
    }
    
    @Override
    public Object clone() throws CloneNotSupportedException 
    {
        return getSingletonObject();
    }
    
    /**
     * All views except topMenu, leftMenu and userPanel
     * @return 
     */
    public ArrayList<ViewContainer> getAllViews()
    {
        return allViews;
    }
    
    public ArrayList<MenuLabel> getMenuLabels()
    {
        return menuLabels;
    }

    public Menu[] getMenus()
    {
        return menus;
    }

    public JFrame getMainFrame()
    {
        return mainFrame;
    }

    public void setMainFrame(JFrame mainFrame)
    {
        this.mainFrame = mainFrame;
    }

    public AdminGraveYard getAdminGraveYard()
    {
        return adminGraveYard;
    }

    public void setAdminGraveYard(AdminGraveYard adminGraveYard)
    {
        this.adminGraveYard = adminGraveYard;
    }

    public AdminCustomer getAdminCustomer()
    {
        return adminCustomer;
    }

    public void setAdminCustomer(AdminCustomer adminCustomer)
    {
        this.adminCustomer = adminCustomer;
    }

    public OrderGraveYard getOrderGraveYard()
    {
        return orderGraveYard;
    }

    public void setOrderGraveYard(OrderGraveYard orderGraveYard)
    {
        this.orderGraveYard = orderGraveYard;
    }

    public OrderCustomer getOrderCustomer()
    {
        return orderCustomer;
    }

    public void setOrderCustomer(OrderCustomer orderCustomer)
    {
        this.orderCustomer = orderCustomer;
    }
}